﻿using BSU.Math.Algebra;

namespace BSU.Math.Geometry
{
    public class RotateMatrix : Matrix3D
    {
        public RotateMatrix(double angleX, double angleY, double angleZ, bool isRadians)
            : base()
        {
            if (!isRadians)
            {
                angleX = Angle.DegreesToRadians(angleX);
                angleY = Angle.DegreesToRadians(angleY);
                angleZ = Angle.DegreesToRadians(angleZ);
            }

            Matrix matrix = new RotateAroundXMatrix(angleX, true);
            matrix = matrix * (new RotateAroundYMatrix(angleY, true));
            matrix = matrix * (new RotateAroundZMatrix(angleZ, true));

            for (int i = 0; i < M; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    this[i, j] = matrix[i, j];
                }
            }
        }
    }
}